feat(nimble_web_search): optional domain/recency/date filters + output_format + result cap#262
Draft
wildcard wants to merge 4 commits into
Draft
Conversation
Adds a Nimble web search integration mirroring exa_web_search and tavily_web_search. The new sources/nimble_web_search package wraps langchain-nimble's NimbleSearchRetriever, supports NIMBLE_API_KEY via env or config, and exposes lite/fast/deep search depths (fast is an enterprise-tier feature that surfaces a clear error on non-enterprise keys; lite is the default). It is wired into the workspace, deploy/Dockerfile (with --no-deps to preserve the frozen lockfile), and scripts/setup.sh. Includes unit tests and documentation updates across the configuration reference, extending guides, installation, deployment, faq, and troubleshooting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and clarify tool description Expose `focus` as a typed Literal config (general, news, location, shopping, geo, social) defaulting to "general", and pass it explicitly to NimbleSearchRetriever. The upstream SDK field is an unvalidated str defaulting to general; the Literal adds parse-time validation and makes the general default explicit. focus is a workflow-config setting, not an agent-chosen parameter, so general research queries cannot silently switch to news. Tighten the tool description the agent sees to state it is a general-purpose web/research search. include_answer remains unexposed in this initial integration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eshold) `news` restricts results to news-publisher sources ordered by recency; it does not apply a recency threshold, so older articles still appear — it changes the source mix, not the time window. Recency windowing is a separate Nimble `time_range` capability that also works with `focus=general`. Reword the config reference, README, and field description to remove the misleading "current events" phrasing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7 tasks
…tput_format, and result cap Expose the remaining langchain-nimble search surface as optional, default-off config: include_domains / exclude_domains (min_length=1; empty list rejected), time_range, start_date / end_date, and output_format. All forward 1:1 to NimbleSearchRetriever and are only sent when set. Enforce max_results as a hard upper bound (the API soft-caps and may return more) for breadth consistent with the sibling providers. Includes unit tests for each field's passthrough, the cap, empty-list rejection, and the filter+empty-result path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4d7c741 to
5eca447
Compare
Collaborator
|
see #261 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional search-refinement controls to the
nimble_web_searchdata source:domain include/exclude lists, recency and date-range filters, and output-format
selection, plus a hard upper bound on result count. Every new field is optional
and defaults off, so existing workflow configs are unaffected.
What changed
New optional
NimbleWebSearchToolConfigfields (forwarded toNimbleSearchRetrieveronly when set):include_domains/exclude_domains— restrict or exclude result domains.Both reject an empty list (
min_length=1); useNone(the default) to disable.time_range— recency window (hour/day/week/month/year).start_date/end_date— published-date range (YYYY-MM-DDorYYYY).output_format—plain_text/markdown(default) /simplified_html.Behavior:
max_resultsis now enforced as a hard upper bound. The API may return morethan requested, so results are sliced to
max_resultsfor predictable breadthconsistent with the other web-search data sources. The API may still return
fewer (a property of any SERP backend), which is surfaced as-is.
include_answerremains intentionally unexposed.Validation:
time_rangeandoutput_formatare constrainedLiteral[...]enums, so invalid values are rejected at config-load.
start_date/end_dateare free-form
str(acceptingYYYY-MM-DDorYYYY); they are forwarded to theSDK as-is rather than format-validated in the provider, matching the
langchain-nimblecontract.Tests
uv run pytest sources/nimble_web_search -q→ 44 passed (12 new: passthroughper field, enum-rejection, empty-domain-list rejection, the upper-bound-cap
behavior, and a filter-active-with-empty-results path).
ruff check/ruff format --check/uv lock --checkclean.Compatibility
All new fields default to
None(or the prior implicit default foroutput_format), so configs that set none of them parse unchanged and the datasource is a strict superset of the base.
One intentional behavior change applies even when no new field is set: because
max_resultsis now a hard upper bound, a workflow that previously receivedmore than
max_resultsresults (the API soft-caps above the requested count)will now receive exactly
max_results. Consumers that already sliced downstreamare unaffected; the rendered
<Document>block format is otherwise unchanged.